package com.example.gaokao.model;

import lombok.*;

import java.util.Objects;

/**
 * autuor:熊小松
 * date：2022/2/14
 * 后台管理实体
 */
/*@Setter 开启自动生成setter
@Getter
@NoArgsConstructor
@ToString
@AllArgsConstructor
@ToString
@EqualsAndHashCode*/
public class User {
  private Integer id;//包装类型允许为空
  private String name;
  private String password;
  private String nick;

  public User() {
  }

  public User(Integer id, String name, String password, String nick) {
    this.id = id;
    this.name = name;
    this.password = password;
    this.nick = nick;
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }


  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }


  public String getNick() {
    return nick;
  }

  public void setNick(String nick) {
    this.nick = nick;
  }

  @Override
  public String toString() {
    return "User{" +
            "id=" + id +
            ", name='" + name + '\'' +
            ", password='" + password + '\'' +
            ", nick='" + nick + '\'' +
            '}';
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (!(o instanceof User)) return false;
    User user = (User) o;
    return Objects.equals(getId(), user.getId()) && Objects.equals(getName(), user.getName()) && Objects.equals(getPassword(), user.getPassword()) && Objects.equals(getNick(), user.getNick());
  }

  @Override
  public int hashCode() {
    return Objects.hash(getId(), getName(), getPassword(), getNick());
  }
}
